package com.service.impl;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dao.GoodsDao;
import com.entity.Goods;
import com.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsDao goodsDao;
    @Override
    public List<Goods> findAll() {
        return goodsDao.selectList(null);
    }

    @Override
    public Goods findById(Integer id) {
        return goodsDao.selectById(id);
    }

    @Override
    public Integer delete(Integer id) {
        return goodsDao.deleteById(id);
    }

    @Override
    public Integer update(Goods goods) {
        return goodsDao.updateById(goods);
    }

    @Override
    public Integer save(Goods goods) {
        return goodsDao.insert(goods);
    }

    @Override
    public Page<Goods> selectPage(Page<Goods> goodsPage) {
        return goodsDao.selectPage(goodsPage, null);
    }
}
